package util;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;

public class ProcessNodes {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String edgeFile = "D:/Research/parinet/edgedata.csv";
		String outFile = "D:/Research/parinet/edgedata_processed.csv";
		BufferedReader in;
		BufferedWriter out;
		try {
			in = new BufferedReader(new FileReader(edgeFile));
			out = new BufferedWriter(new FileWriter(outFile));
			String str;
			while ((str = in.readLine()) != null) {
				StringTokenizer st = new StringTokenizer(str);
				int id = Integer.parseInt(st.nextToken());
				long roadid = Long.parseLong(st.nextToken());
				int x1 = Integer.parseInt(st.nextToken());
				int y1 = Integer.parseInt(st.nextToken());
				int x2 = Integer.parseInt(st.nextToken());
				int y2 = Integer.parseInt(st.nextToken());
				if (x1 > x2) {
					int temp = x1;
					x1 = x2;
					x2 = temp;
				}
				if (y1 > y2) {
					int temp = y1;
					y1 = y2;
					y2 = temp;
				}
				out.write(id + "\t" + roadid + "\t" + x1 + "\t" + y1 + "\t"
						+ x2 + "\t" + y2);
				out.newLine();
			}

			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
